package com.xcc.factorypattern;

import com.xcc.factorypattern.demo01.PizzaStore;
import com.xcc.factorypattern.demo02.SimplePizzaFactory;
import com.xcc.factorypattern.demo03.CaliforniaPizzaStore;
import com.xcc.factorypattern.demo03.ChicagoPizzaStore;
import com.xcc.factorypattern.demo03.NYPizzaStore;
import com.xcc.factorypattern.demo03.Pizza;

/**
 * @Author: xiechuang
 * @Date: 2022/9/2
 */
public class Demo {

    public static void main(String[] args) {
        PizzaStore pizzaStore = new PizzaStore();
        pizzaStore.orderPizza("cheese");

        com.xcc.factorypattern.demo02.PizzaStore pizzaStore1 = new com.xcc.factorypattern.demo02.PizzaStore(new SimplePizzaFactory());
        pizzaStore1.orderPizza("greek");

        com.xcc.factorypattern.demo03.PizzaStore nyPizzaStore = new NYPizzaStore();
        com.xcc.factorypattern.demo03.PizzaStore chicagoStore = new ChicagoPizzaStore();
        com.xcc.factorypattern.demo03.PizzaStore californiStore = new CaliforniaPizzaStore();

        Pizza pizza = nyPizzaStore.orderPizza("cheese");
        System.out.println("ordered a " + pizza.getName() + "\n");

        pizza = chicagoStore.orderPizza("cheese");
        System.out.println("ordered a " + pizza.getName() + "\n");

        pizza = californiStore.orderPizza("cheese");
        System.out.println("order a " + pizza.getName() + "\n");

        com.xcc.factorypattern.demo04.PizzaStore nyPizzaStore2 = new com.xcc.factorypattern.demo04.NYPizzaStore();
        nyPizzaStore2.orderPizza("cheese");

        com.xcc.factorypattern.demo04.PizzaStore chicagoPizzaStore2 = new com.xcc.factorypattern.demo04.ChicagoPizzaStore();
        chicagoPizzaStore2.orderPizza("cheese");

    }

}
